

import 'package:quick_dev_plugin/utils/log_util.dart';
import 'package:quick_dev_plugin/utils/toast_utils.dart';

mixin BackAffirm {
  DateTime? lastClick;
  Future<bool> onWillPop() async {
    LogUtil.logI("进入BackAffirm");
    if (lastClick == null
        ? true
        : DateTime.now().difference(lastClick!) > const Duration(seconds: 2)) {
      lastClick = DateTime.now();
      ToastUtils.showTip("再次点击退出app");
      return false;
    } else {
      return true;
    }
  }
}